import { User } from "../models/user.model";

const USER_INFO = "USER_INFO";

export class LocalStorage {
  static getUserInfo(): User | undefined {
    const userInfo = wx.getStorageSync(USER_INFO);
    if (!userInfo) {
      return undefined;
    }
    return JSON.parse(wx.getStorageSync(USER_INFO)) as User;
  }
  static setUserInfo(userInfo: User) {
    wx.setStorageSync(USER_INFO, JSON.stringify(userInfo));
  }
}